export default {

    arrayContainTwiceIf(array, call) {
        if (array == null || array == undefined) {
            return false;
        }
        if (array.length < 2) {
            return false;
        }
        let num = 0;
        for (let i = 0; i < array.length; i++) {
            const data = array[i];
            if (call(data)) {
                num++;
            }
            if (num == 2) {
                console.log("返回True");
                return true;
            }
        }
        console.log("返回False");
        return false;
    },
    arrayRemoveIf(array,call){
        let result = [];
        if (array == null || array == undefined) {
            return result;
        }
        if (array.length < 1) {
            return result;
        }
        for (let i = 0; i < array.length; i++) {
            const data = array[i];
            if (call(data)) {
                result.push(array.splice(i,1))
                i--;
            }
        }
        return result;
    }

}